package com.itcast.consumer.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itcast.consumer.domain.Setmeal;
import com.itcast.consumer.domain.request.SetmealPageReqDTO;
import com.itcast.consumer.domain.response.SetmealDetailResDTO;
import com.itcast.consumer.domain.response.SetmealPageResDTO;
import com.itcast.consumer.mapper.SetmealMapper;
import com.itcast.consumer.service.ISetmealService;
import com.jzo2o.common.model.PageResult;
import com.jzo2o.mysql.utils.PageHelperUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 套餐表 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-11-05
 */
@Service
public class SetmealServiceImpl extends ServiceImpl<SetmealMapper, Setmeal> implements ISetmealService {



    /**
     * 分页查询套餐
     *
     * @param setmealPageReqDTO
     * @return
     */
    @Override
    public PageResult<SetmealPageResDTO> pageQuery(SetmealPageReqDTO setmealPageReqDTO) {
        return PageHelperUtils.selectPage(setmealPageReqDTO, ()-> baseMapper.pageQuery(setmealPageReqDTO));
    }

    /**
     * 根据id查询套餐详情
     *
     * @param id
     * @return
     */
    @Override
    public SetmealDetailResDTO findDetail(Integer id) {
        return baseMapper.findDetail(id);
    }
}
